package com.uam.web.controller.recordset;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.uam.common.annotation.Log;
import com.uam.common.core.controller.BaseController;
import com.uam.common.core.domain.AjaxResult;
import com.uam.common.enums.BusinessType;
import com.uam.recordset.domain.TTcjl;
import com.uam.recordset.service.ITTcjlService;
import com.uam.common.utils.poi.ExcelUtil;
import com.uam.common.core.page.TableDataInfo;

/**
 * 探测记录Controller
 * 
 * @author uam
 * @date 2025-09-10
 */
@RestController
@RequestMapping("/recordset/tcjl")
public class TTcjlController extends BaseController
{
    @Autowired
    private ITTcjlService tTcjlService;

    /**
     * 查询探测记录列表
     */
    @PreAuthorize("@ss.hasPermi('recordset:tcjl:list')")
    @GetMapping("/list")
    public TableDataInfo list(TTcjl tTcjl)
    {
        startPage();
        List<TTcjl> list = tTcjlService.selectTTcjlList(tTcjl);
        return getDataTable(list);
    }

    /**
     * 导出探测记录列表
     */
    @PreAuthorize("@ss.hasPermi('recordset:tcjl:export')")
    @Log(title = "探测记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TTcjl tTcjl)
    {
        List<TTcjl> list = tTcjlService.selectTTcjlList(tTcjl);
        ExcelUtil<TTcjl> util = new ExcelUtil<TTcjl>(TTcjl.class);
        util.exportExcel(response, list, "探测记录数据");
    }

    /**
     * 获取探测记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('recordset:tcjl:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tTcjlService.selectTTcjlById(id));
    }

    /**
     * 新增探测记录
     */
    @PreAuthorize("@ss.hasPermi('recordset:tcjl:add')")
    @Log(title = "探测记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TTcjl tTcjl)
    {
        return toAjax(tTcjlService.insertTTcjl(tTcjl));
    }

    /**
     * 修改探测记录
     */
    @PreAuthorize("@ss.hasPermi('recordset:tcjl:edit')")
    @Log(title = "探测记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TTcjl tTcjl)
    {
        return toAjax(tTcjlService.updateTTcjl(tTcjl));
    }

    /**
     * 删除探测记录
     */
    @PreAuthorize("@ss.hasPermi('recordset:tcjl:remove')")
    @Log(title = "探测记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tTcjlService.deleteTTcjlByIds(ids));
    }
}
